﻿using System;
using System.Text;

namespace IcqSharp
{
    public static class StringExtensions
    {
        public static Byte[] GetAsciiBytes(this String s)
        {
            return Encoding.ASCII.GetBytes(s);
        }
        public static Byte[] GetUnicodeBytes(this String s)
        {
            return Encoding.Unicode.GetBytes(s);
        }

        public static String ToAsciiString(this Array a)
        {
            if (!(a is Byte[])) return null;
            return Encoding.ASCII.GetString(a as Byte[]);
        }
        public static String ToUnicodeString(this Array a)
        {
            if (!(a is Byte[])) return null;
            return Encoding.Unicode.GetString(a as Byte[]);
        }
    }
}
